package com.practice.recursive;

import java.util.ArrayList;

public class Assignment {
	private ArrayList<Integer>[] machine;
	
	private boolean conflict(int job, int cur) {
		return false;
	}
	
	private boolean conflictOnMachine(int i, int cur) {
		for (int job : machine[i]) {
			if (conflict(job, cur)) return true;
		}
		return false;
	}

	private int dfs(int n, int m, int cur, int assigned) {
		int ret = 0;
		if (cur == n) return 1;
		int eligible = Math.min(assigned + 1, m);
		for (int i = 0; i < eligible; i++) {
			if (conflictOnMachine(i, cur)) continue;
			machine[i].add(cur);
			ret += dfs(n, m, cur + 1, i >= assigned ? assigned + 1 : assigned);
			machine[i].remove(machine[i].size() - 1);
		}
		return ret;
	}

	public int solve(int n, int m) {
		machine = new ArrayList[m];
		for (int i=0; i<m; i++) {
			machine[i] = new ArrayList<Integer>();
		}
		return dfs(n, m, 0, 0);
	}

	public static void main(String[] args) {
		Assignment a = new Assignment();
		for (int i = 1; i < 11; i++)
			System.out.print(a.solve(i, i) + " ");
		System.out.println();
	}
}
